﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;

namespace DAL
{
    public class QuestionSurVeyRepository : IQuestionSurVeyRepository
    {
        private QuestionSurVeyContext context = new QuestionSurVeyContext();


        public QuestionSurVey GetById(int questionSurVeyId)
        {
            return context.QuestionsSurVey.SingleOrDefault(c => c.ID == questionSurVeyId);
        }

        public IQueryable<QuestionSurVey> GetAll()
        {
            return context.QuestionsSurVey;
        }

        public void AddQuestionSurVey(QuestionSurVey qv)
        {
            context.QuestionsSurVey.Add(qv);
            context.SaveChanges();
        }

        public void DeleteQuestionSurVey(QuestionSurVey qv)
        {
            context.QuestionsSurVey.Remove(qv);
            context.SaveChanges();
        }
    }
}
